********************************************************************************************************************
*****Do-file for Tables A5-7
*****Who is mobilized to vote by short text messages? Evidence from a nationwide field experiment with young voters
********************************************************************************************************************
*****Last edited 24/6/5
********************************************************************************************************************
*****Ado packages needed: estout
********************************************************************************************************************


clear all


use \data\dataforanalysis230522_v2.dta, clear


replace age=age+3 //replace age for age in 2022

rename svatva_k income
keep if treated!=.

*************************************************
*****TABLE A5
*************************************************

eststo s1: estpost tabstat female age highschool income foreign if mhighschool!=.,statistics(mean sd) columns(statistics)
eststo s2: estpost tabstat female age highschool income foreign if mhighschool==.,statistics(mean sd) columns(statistics)


esttab, cells(mean(fmt(2)) sd(fmt(2) par)) unstack nonote nonumber noobs stats(N, fmt(a) labels("Observations")) mtitles("Mother Highschool Known" "Mother Highschool Not Known") replace

eststo clear

*************************************************
*****TABLE A6
*************************************************


sum pvote_mother if voted22!=.  & treated!=. & female!=., detail
gen marginal=.
replace marginal=1 if pvote_mother>=r(p25) & pvote_mother<r(p75)
replace marginal=0 if pvote_mother<r(p25) | (pvote_mother>=r(p75) & pvote_mother!=.)

gen never=.
replace never=1 if pvote_mother<r(p25)
replace never=0 if pvote_mother>=r(p25) & pvote_mother!=.

gen always=.
replace always=1 if pvote_mother>=r(p75) & pvote_mother!=.
replace always=0 if pvote_mother<r(p75)

eststo clear

eststo s1: estpost tabstat female age mohighschool income foreign if never==1,statistics(mean sd) columns(statistics)
eststo s2: estpost tabstat female age mohighschool income foreign if marginal==1,statistics(mean sd) columns(statistics)
eststo s3: estpost tabstat female age mohighschool income foreign if always==1,statistics(mean sd) columns(statistics)


esttab, cells(mean(fmt(2)) sd(fmt(2) par)) unstack nonote nonumber noobs stats(N, fmt(a) labels("Observations")) mtitles("Low Propensity" "Marginal Voters" "High Propensity") replace

eststo clear

*************************************************
*****TABLE A7
*************************************************

sum pvote_enet_mother if voted22!=. & treated!=. & female!=., detail
replace marginal=.
replace marginal=1 if pvote_enet_mother>=r(p25) & pvote_enet_mother<r(p75)
replace marginal=0 if pvote_enet_mother<r(p25) | (pvote_enet_mother>=r(p75) & pvote_enet_mother!=.)

replace never=.
replace never=1 if pvote_enet_mother<r(p25)
replace never=0 if pvote_enet_mother>=r(p25) & pvote_enet_mother!=.

replace always=.
replace always=1 if pvote_enet_mother>=r(p75) & pvote_enet_mother!=.
replace always=0 if pvote_enet_mother<r(p75)


eststo s1: estpost tabstat female age mohighschool income foreign if never==1,statistics(mean sd) columns(statistics)
eststo s2: estpost tabstat female age mohighschool income foreign if marginal==1,statistics(mean sd) columns(statistics)
eststo s3: estpost tabstat female age mohighschool income foreign if always==1,statistics(mean sd) columns(statistics)


esttab, cells(mean(fmt(2)) sd(fmt(2) par)) unstack nonote nonumber noobs stats(N, fmt(a) labels("Observations")) mtitles("Low Propensity" "Marginal Voters" "High Propensity") replace



